<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            padding-bottom: 800px;
        }
        .list{
            display: flex;
            flex-flow: row wrap;
        }
        .list .btn{
            width: 80px;
            padding: 4px 10px;
            border-radius: 6px;
            background-color: #dedede;
            margin-right: 10px;
            text-align: center;
            cursor: pointer;
        }
        .list .btn.active{
            background-color: orangered;
            color: white;
        }
    </style>
</head>
<body>
    <div id="app">
        <!-- 
            1、分解功能
            2、基于响应式控制页面变化操作
            3、整合开发逻辑
        -->
        <div class="city-box">
            <div class="info">
                <span>区域:</span>
                <span>{{ city }}</span>
                <span>*</span>
            </div>
            <div class="list">
                <div v-bind:class=" city=='江浙沪'?'btn active':'btn' " v-on:click="changeCity( '江浙沪' )">江浙沪</div>
                <div v-bind:class=" city=='珠三角'?'btn active':'btn' " v-on:click="changeCity( '珠三角' )">珠三角</div>
                <div v-bind:class=" city=='北京'?'btn active':'btn' " v-on:click="changeCity( '北京' )">北京</div>
            </div>
        </div>
    </div>
    <script type="module"> 
        import { createApp } from "../assets/vue3/vue.esm-browser.js";
        createApp({
            data(){
                return {
                    city:"请选择区域"
                }
            },
            methods:{
                changeCity(c){
                    this.city = c;
                }
            }
        }).mount("#app")
    </script>
</body>
</html>